<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ include file="/taglibs.jsp"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath() %>'/>
<c-rt:set var="frontHostName" value='<%=ServerValue.getFrontHostname()%>'/>
<c-rt:set var="frontContextPath" value='<%=ServerValue.getFrontContextPath()%>'/>
<s:url value="/images" var="imgPath"/>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="/css/smoothness.datepick.css" />
<script language="javascript">
	$().ready( function() {
		$("#actDateParam").datepick({minDate: new Date(),showOn:'both',numberOfMonths:2, buttonImageOnly: true, buttonImage: '${imgPath}/calendar.gif',dateFormat:"yy-mm-dd"});
	});
</script>
<h1>渠道广告管理<br/>
<div class="f-link">
	<a href="${midContextPath}/menu/editChannel.do?editType=channel">新增渠道</a>
	<a href="${midContextPath}/channel/add.do">新增</a>
</div>
</h1><br/>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<br/>

<div class="data-form">
	<s:form action="search.do" method="post">
		<b>渠道：</b>
		<s:select name="channelNameParam" list="channelNameMenu.options" listKey="key"  headerKey="" headerValue="全部" listValue="value.name"/>
		<b>活动日期：</b>
		<input name="actDateParam" id="actDateParam" type="text" title="活动日期"  size="10" maxlength="10" value="${actDateParam}" >
	  <b>活动类别：</b>
	  <s:radio name="actTypeParam" list="channelTypeMenu.options" listKey="key" listValue="value.name" value="%{actTypeParam}"/>
	  <b>狀態：</b>
	  <s:select name="channelStatusParam" list="channelStatusMenu.options" listKey="key"  listValue="value.name"/>
		<input type="submit" id="searchbtn" value="查询"/>	
	</s:form>
</div>
<br/>

<table class="tb-1" width="100%">
	<thead>
		<tr>
			<th>类别</th>
			<th>渠道</th>
			<th>代码</th>
			<th>活动效期</th>
			<th>活动名称</th>
			<th>活动网址</th>
			<th>活动代码</th>
			<th>状态</th>
			<th>功能</th>
		</tr>
	</thead>
	<tbody>
				<c-rt:forEach items="${channelList}" var="channel" varStatus="index">
					<tr>
						<td>${channelTypeMenu.options[actTypeParam].name}</td>
						<td>${channelNameMenu.options[channel.channelName].name}</td>
						<td>${channel.channelName}</td>
						<td>
							<fmt:formatDate value="${channel.startDate}" pattern="yyyy-MM-dd HH:mm" /> ~ 
							<fmt:formatDate value="${channel.endDate}" pattern="yyyy-MM-dd HH:mm" /> 
						</td>
						<td>${channel.actName}</td>
						<td>
						<c-rt:set var="baseUrl">${frontHostName}${frontContextPath}/channel/ad.do?id=${channel.id}&site=${channel.channelName}</c-rt:set>
						<c-rt:if test="${channel.actType ne '2'}">
							<c-rt:set var="baseUrl">${baseUrl}&url=${frontHostName}${channel.actUrl}</c-rt:set>
						</c-rt:if>
						<a href="${baseUrl}" target="_blank">${frontHostName}${channel.actUrl}</a>
						</td>
						<td>${channel.id}</td>
						<td>${channelStatusMenu.options[channel.channelStatus].name}</td>
						<td><a href="edit.do?actId=${channel.id}">修改</a></td>
					</tr>
				</c-rt:forEach>
	</tbody>
</table>
<yaodian100:pageutil link="${midContextPath}/channel/search.do" pagerObj="${pager}" />